# Metview Macro

# **************************** LICENSE START ***********************************
#
# Copyright 2013 ECMWF. This software is distributed under the terms
# of the Apache License version 2.0. In applying this license, ECMWF does not
# waive the privileges and immunities granted to it by virtue of its status as
# an Intergovernmental Organization or submit itself to any jurisdiction.
#
# ***************************** LICENSE END ************************************

# This macro illustrates how to retrieve free data from ECMWF's Data Server
# (currently, August 2013, at http://apps.ecmwf.int/datasets/).
# Note that registration is required in order to retrieve data from
# these datasets. Note also that printing the results of the requests
# forces the requests to be made sequentially; a more efficient way
# of doing it would be to have the print statements together at the end
# of the macro - in this case, the data requests would be made asynchronously.


if 1 then
# retrieve data from the TIGGE dataset
print("Retrieving TIGGE data...")
tigge_data = retrieve
(
    dataset  : "tigge",
    type     : "pf",
    levtype  : "SL",
    param    : "tp",
    date     : [20071001],
    step     : [24],
    time     : [0, 12],
    #origin   : 'all',
    number   : 'all',
    #grid     : [2.0,2.0],
    database : "Data Server"
)
print("TIGGE data: ", tigge_data)
end if


if 1 then
# retrieve data from the ERA Interim dataset
print("Retrieving ERA data...")
era_data = retrieve
(
    dataset  : "interim",
    stream   : "oper",
    type     : "fc",
    class    : "ei",
    levtype  : "sfc",
    param    : "235.128",
    date     : 2013-05-01,
    step     : 12,
    time     : 12,
    database : "Data Server"
)
print("ERA Interim data: ", era_data)
end if


if 1 then
# retrieve data from the YOTC dataset (Year of Tropical Convection)
print("Retrieving YOTC data...")
yotc_data = retrieve
(
    dataset  : "yotc",
    class    : "yt",
    type     : "an",
    levtype  : "sfc",
    param    : "168",
    date     : 20080901,
    step     : 0,
    time     : 12,
    grid     : [2.0,2.0],
    database : "Data Server"
)
print("YOTC data: ", yotc_data)
end if

